<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="./Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="./Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="./Public/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="./Public/Admin/Flat/img/favicon.ico">
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	    <script src="./Public/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	    <style type="text/css">
	    	table{font-size: 14px;}
	    	.sel_width{
	    		margin-top: 5px;
	    		width: 200px;
	    		font-size: 18px;
	    		margin-left: 40px;
	    	}
	    	.n_num{width: 50px;}
	    	.n_state{width: 100px;}
	    	.n_sendtime{width: 150px;}
	    	.n_sendtime{width: 150px;}
	    	.n_lucky{width: 130px;}
	    </style>
	    <script type="text/javascript">
	    	$(function(){
	    		$('#sel_change').change(function(){
	    			var num = $(this).val();
	    			//alert(num)
	    			$.ajax({
	    				//请求方式
	    				type:"post",
	    				//请求地址
	    				url:"{{U('selectPeriods')}}",
	    				//发送数据
	    				data:{pNum:num},
	    				//指定php返回的数据类型
	    				dataType:'json',
	    				//得到服务器响应
	    				success:function(goodsData){
	    					var goods = '';
	    					
	    					var gth = '';
	    					gth += '<tr><th class="n_num">期数ID</th><th>商品名称</th><th>期数</th><th class="n_state">状态</th>';
	    					gth += '<th class="n_sendtime">开始时间</th><th class="n_sendtime">揭晓时间</th>';
	    					gth += '<th class="n_lucky">幸运号码</th></tr>';
	    					
	    					var gtd = '';
	    					$.each(goodsData, function(k,v) {
	    						gtd += '<tr><td> '+v.gpid+' </td><td> '+v.gname+' </td><td> '+v.periods+' </td><td> '+v.state+' </td>';
	    						gtd += '<td> '+v.start_time+' </td><td> '+v.end_time+' </td><td> '+v.luck_num+' </td></tr>';
	    					});
	    					
	    					goods = gth + gtd;
	    					$('#n_table').html(goods);
	    				}
	    			});
	    		})
	    	})
	    </script>
	</head>
	<body>
		<table class="table table-hover">
			<tr>
		  		<th class="n_num"><span class="btn btn-success">开奖期数</span></th>
		  		<th colspan="5">
			  		<select class="sel_width" name="cid" id="sel_change">
			  			<option value="0">--------选择期数-------</option>
			  			{{foreach from="$data" value="$v"}}
			  				<option value="{{$v['periods']}}">--------第{{$v['periods']}}期-------</option>
			  			{{endforeach}}
			  		</select>
			  		<select class="sel_width">
			  			<option value="0">选择商品</option>
			  			<option value=""></option>
			  		</select>
			  	</th>
			</tr>
			<tr>
				<th colspan="6"><span class="btn btn-success">期数信息</span></th>
			</tr>
		</table>
		<table class="table table-hover" id="n_table">
			<!--<tr>
				<th class="n_num">期数ID</th>
				<th>商品名称</th>
				<th class="n_state">状态</th>
				<th class="n_sendtime">开始时间</th>
				<th class="n_sendtime">揭晓时间</th>
				<th class="n_lucky">幸运号码</th>
			</tr>
			<tr>
				<td>1</td>
				<td>Haier/海尔 EG7012B29W 7公斤 变频全自动 滚筒洗衣机 消毒洗【包邮】</td>
				<td>未开奖</td>
				<td>2016-5-30 00:00:00:00</td>
				<td>2016-5-30 00:00:00:00</td>
				<td>10005100</td>
			</tr>-->
		</table>
	</body>
	
	
	
	
	
	
	
	
	
	<!--<script type="text/javascript">
		$(function(){
			$('#sel_change').change(function(){
				var num = $(this).val();
				//alert (num);
				$.ajax({
					type:"post",
					url:"{{U('selectNum')}}",
					data:{num:num},
					dataType:'json',
					success:function(numData){
						var alltr = '';
						//连接th部分
						var sth = '';
						sth += '<tr><th class="n_num">期数ID</th><th>商品名称</th><th class="n_state">状态</th>';
						sth += '<th class="n_sendtime">开始时间</th><th class="n_sendtime">揭晓时间</th>';			
						sth += '<th class="n_lucky">幸运号码</th></tr>';			
							
						//连接td部分
						//循环连接字符串 变量应该放在外面 放在循环内部每次循环会覆盖掉之前的 
						var std = '';
						$.each(numData, function(k,v) {
							
							std += '<tr><td>' + v.nid + '</td><td>' + v.gname + '</td><td>' + v.n_state + '</td>';
							
							std += '<td>' + v.n_sendtime + '</td><td>' + v.n_endtime + '</td><td>' + v.lucky + '</td>';
							
						});
						
						alltr = sth + std;
						$('#n_table').html(alltr);
					}
				});
			});
		});
	</script>-->
</html>
